# use strict;
#use warnings;
use Imager;
use Plack::Request;

$app = sub {
    my ($env) = @_;
    my $req = Plack::Request->new($env);
    $path_info = $req->path_info;
};
$img = Imager->new;
$img->read( file => "$path_info" );
$img = $img->scale(
    xpixels => 60,
    ypixels => 60,
);
$img->write( file => './data/okkai.jpg' )
    or die $img->errstr;

my $res = $req->new_response;
$res->status(200);
$res->content_type('text/html');
my $html = "<img src='./data/test.jpg'>";
$res->body($html);

return $res->finalize;
